package com.boronstream.istar.model;

import java.util.Iterator;

import org.json.JSONException;
import org.json.JSONObject;

public class Iphone extends PlayObject {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private long _id;
	private String device_id;
	private String wifi_mac;
	private String build_brand;
	private String build_model;
	private String create_time;
	private String update_time;

	public Iphone(JSONObject jObject) {
		try {
			Iterator<String> keys = jObject.keys();
			while (keys.hasNext()) {
				String key = keys.next();
				initParamWithJsonAndKey(jObject, key);
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public long get_id() {
		return _id;
	}

	public void set_id(long _id) {
		this._id = _id;
	}

	public String getDevice_id() {
		return device_id;
	}

	public void setDevice_id(String device_id) {
		this.device_id = device_id;
	}

	public String getWifi_mac() {
		return wifi_mac;
	}

	public void setWifi_mac(String wifi_mac) {
		this.wifi_mac = wifi_mac;
	}

	public String getBuild_brand() {
		return build_brand;
	}

	public void setBuild_brand(String build_brand) {
		this.build_brand = build_brand;
	}

	public String getBuild_model() {
		return build_model;
	}

	public void setBuild_model(String build_model) {
		this.build_model = build_model;
	}

	public String getCreate_time() {
		return create_time;
	}

	public void setCreate_time(String create_time) {
		this.create_time = create_time;
	}

	public String getUpdate_time() {
		return update_time;
	}

	public void setUpdate_time(String update_time) {
		this.update_time = update_time;
	}

	@Override
	public String toString() {
		return "Iphone [_id=" + _id + ", device_id=" + device_id
				+ ", wifi_mac=" + wifi_mac + ", build_brand=" + build_brand
				+ ", build_model=" + build_model + ", create_time="
				+ create_time + ", update_time=" + update_time + "]";
	}

	@Override
	public void initParamWithJsonAndKey(JSONObject jsonObject, String key)
			throws JSONException {
		if ("_id".equals(key)) {
			this.set_id(jsonObject.getLong(key));
		}
		if ("device_id".equals(key)) {
			this.setDevice_id(jsonObject.getString(key));
		}
		if ("wifi_mac".equals(key)) {
			this.setWifi_mac(jsonObject.getString(key));
		}
		if ("build_brand".equals(key)) {
			this.setBuild_brand(jsonObject.getString(key));
		}
		if ("build_model".equals(key)) {
			this.setBuild_model(jsonObject.getString(key));
		}
		if ("create_time".equals(key)) {
			this.setCreate_time(jsonObject.getString(key));
		}
		if ("update_time".equals(key)) {
			this.setUpdate_time(jsonObject.getString(key));
		}
	}

}
